Skip to content

filesystem: convert free functions to object methods#5692

Merged
mattklein123 merged 4 commits intoenvoyproxy:masterfrom
greenhouse-org:filesystem-object
Jan 30, 2019
Merged

filesystem: convert free functions to object methods#5692
mattklein123 merged 4 commits intoenvoyproxy:masterfrom
greenhouse-org:filesystem-object

Conversation

@sesmith177
Copy link
Member

Description:

Move the free functions in Envoy::Filesystem to the Filesystem::Instance object. Pass the API object containing the Instance object through everywhere filesystem access is needed. Update canonicalPath to return SysCallStringResult instead of throwing an exception as requested in feedback on #5470 (comment)

This is step 1/3 in breaking up #5470 to add Windows filesystem support as outlined here: #5470 (comment)

This PR also overlaps a bit with #5660, so we should probably get one of them through first

cc @jmarantz @mattklein123 @lizan

Risk Level:
Low, though this change touches many files.

Testing:
bazel build //source/... && bazel test //test/...

Docs Changes:
N/A
Release Notes:
N/A

Move the free functions in Envoy::Filesystem to the
Filesystem::Instance object. Pass the API object containing
the Instance object through everywhere filesystem access is needed.

This is step 1/3 in adding Windows filesystem support

Signed-off-by: Sophie Wigmore <swigmore@pivotal.io>
Signed-off-by: Sam Smith <sesmith177@gmail.com>
jmarantz
jmarantz previously approved these changes Jan 26, 2019
Copy link
Contributor

@jmarantz jmarantz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is epic but fairly easy to review with patience. Just a few nits.

*/
class Watcher {
public:
typedef std::function<void(uint32_t events)> OnChangedCb;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer 'using' to 'typedef'.


class ConfigSchemasTest : public ::testing::TestWithParam<std::string> {};
class ConfigSchemasTest : public ::testing::TestWithParam<std::string> {
public:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

general pattern is to use 'protected' here in a test class.

TEST(JsonLoaderTest, Basic) {
EXPECT_THROW(Factory::loadFromFile("bad_file"), Exception);
class JsonLoaderTest : public testing::Test {
public:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

protected, here & below...I won't point out additional instances of that.

@jmarantz
Copy link
Contributor

and you'll need to merge master of course.

Signed-off-by: Sam Smith <sesmith177@gmail.com>
Signed-off-by: Sam Smith <sesmith177@gmail.com>
jmarantz
jmarantz previously approved these changes Jan 30, 2019
@mattklein123 mattklein123 self-assigned this Jan 30, 2019
@mattklein123
Copy link
Member

@sesmith177 thanks for slogging through this. This is going to be great for us in the future. Can you merge master and we can get this merged?

Signed-off-by: Sam Smith <sesmith177@gmail.com>
@sesmith177
Copy link
Member Author

@mattklein123 @jmarantz merged

Copy link
Contributor

@jmarantz jmarantz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@envoyproxy/web-maintainers we should try to merge this as soon as it passes CI and preferably before other PRs get merged, as this is likely to be on an always-needing-merge-then-CI-and-approve treadmill.

@dnoe
Copy link
Contributor

dnoe commented Jan 30, 2019

I think you meant to tag @envoyproxy/maintainers . @mattklein123 's response above sounds like approval, but technically we don't have the senior maintainer approval bit set. So if someone with that power can approve we can merge as soon as CI is complete.

@mattklein123 mattklein123 merged commit 88fe0c9 into envoyproxy:master Jan 30, 2019
danzh2010 pushed a commit to danzh2010/envoy that referenced this pull request Jan 31, 2019
Move the free functions in Envoy::Filesystem to the
Filesystem::Instance object. Pass the API object containing
the Instance object through everywhere filesystem access is needed.

This is step 1/3 in adding Windows filesystem support

Signed-off-by: Sophie Wigmore <swigmore@pivotal.io>
Signed-off-by: Sam Smith <sesmith177@gmail.com>
fredlas pushed a commit to fredlas/envoy that referenced this pull request Mar 5, 2019
Move the free functions in Envoy::Filesystem to the
Filesystem::Instance object. Pass the API object containing
the Instance object through everywhere filesystem access is needed.

This is step 1/3 in adding Windows filesystem support

Signed-off-by: Sophie Wigmore <swigmore@pivotal.io>
Signed-off-by: Sam Smith <sesmith177@gmail.com>
Signed-off-by: Fred Douglas <fredlas@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants